﻿using Lhz.Pp.Entity.Database;
using System.Collections.Generic;

namespace Lhz.Pp.Test
{
    public static class EntityFactory
    {
        public static Application BuildApplication()
        {
            return new Application()
            {
                Name = "AtName"
            };
        }

        public static Region BuildRegion()
        {
            return new Region()
            {
                Code = "AtCode",
                Name = "AtName",
                Children = new List<Region>(),
                SuperiorRegionManagements = new List<RegionManagement>(),
                SubordinateRegionManagements = new List<RegionManagement>()
            };
        }

        public static RegionManagement BuildRegionManagement(Application application, Region superiorRegion, Region subordinateRegion)
        {
            return new RegionManagement()
            {
                ApplicationGuid = application.Guid,
                Application = application,
                SuperiorGuid = superiorRegion.Guid,
                Superior = superiorRegion,
                SubordinateGuid = subordinateRegion.Guid,
                Subordinate = subordinateRegion
            };
        }

        public static Organization BuildOrganization()
        {
            return new Organization()
            {
                Name = "AtName",
                Children = new List<Organization>(),
                SuperiorOrganizationManagements = new List<OrganizationManagement>(),
                SubordinateOrganizationManagements = new List<OrganizationManagement>()
            };
        }

        public static User BuildUser()
        {
            return new User()
            {
                Username = "AtUsername",
                Password = "AtPassword",
                Name = "AtName",
                Phone = "AtPhone",
                Organizations = new List<Organization>(),
                UserRoles = new List<UserRole>()
            };
        }

        public static Role BuildRole()
        {
            return new Role()
            {
                Name = "AtName",
                Type = 1
            };
        }
    }
}
